<?php

namespace Api\Controller;

use Think\Controller;
use Think\Cache\RedisCache;
use Think\Api;
use Utils\Image;

class SpiderIndexController extends Controller {

    private $newsInfo = "newsInfo";
    private $resTime = 6;
    private $resultData = [];

    function __construct() {
        parent::__construct();
        $this->_redis = RedisCache::getIntance(RedisCache::REDIS_CMS);
    }

    public function getList() {
        $unix = time();
        $url = "https://open.uczzd.cn/openiflow/openapi/v2/channel/100";
        $url .= '?content_ratio=100&auto=0&method=his&recoid=3886031014849886267';
        $url .= '&ftime=' . $unix;
        $url .= '&app=ucpc-iflow';
        $url .= '&dn=38223e52114d14bebe2dd55859899df6v00000029dae49a0&fr=win32';
        $url .= '&nt=99999';
        $url .= '&access_token=1505380200352-ef6635730e54e348b994c0b138d3342a-287dc7f13ce30a78c358b843d0fd0c62';
        $list = Api::request($url);
        $content = [];
        foreach ($list["data"]["articles"] as $value) {
            $v["title"] = $value["title"];
            $v["url"] = $value["url"];
            $v["tags"] = $value["tags"];
            $v["content"] = $value["content"];
            $v["thumbnails"] = $value["thumbnails"];
            $content[] = $v;
        }
        echo "<pre>";
        print_r($content);
        echo "</pre>";
    }

}
